app
.controller('formSelfCtrl', ['$scope', '$http', FormSelfController]);
function FormSelfController($scope, $http){
	$scope.changeValueMap = function(field) {
		if (field == 'reconciliationDayBegin' || field == 'reconciliationDayEnd') {
			
			var reconciliationDayBegin = $scope.valueMap['reconciliationDayBegin'];
			var reconciliationDayEnd = $scope.valueMap['reconciliationDayEnd'];
			if(reconciliationDayBegin && reconciliationDayEnd) {
				var indexOfLoading = layer.load(1, {shade: [0.5,'#000000']});
				$http.post('/api/inter/tcwWanliReconciliation/getAmounts', {}, {params: {reconciliationDayBegin: reconciliationDayBegin, reconciliationDayEnd: reconciliationDayEnd}})
				.success(function (response) {
					if(response.code == 0) {
						$scope.valueMap['amountGbp'] = response.data.amountGbp;
						$scope.valueMap['amountUsd'] = response.data.amountUsd;
						$scope.valueMap['amountEur'] = response.data.amountEur;
						$scope.valueMap['feeGbp'] = response.data.feeGbp;
						$scope.valueMap['feeUsd'] = response.data.feeUsd;
						$scope.valueMap['feeEur'] = response.data.feeEur;
						$scope.valueMap['amountCny'] = response.data.amountCny;
					}
					layer.closeAll();
				});
			}
		}
	}
}